home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
SYMBMATH.H38
< prev
next >
Wrap
Text File
|
1993-11-14
|
4KB
|
147 lines
4.6 Integration
You can find integrals of x^m*e^(x^n), x^m*e^(-x^n),
e^((a*x+b)^n), e^(-(a*x+b)^n), x^m*ln(x)^n, ln(a*x+b)^n, etc., (where m
and n are any real number).
It is recommended that before you do symbolic integration, you
should simplify integrand, e.g. expand the integrand by expand() and/or
by setting the switch expand:=on and/or expandexp:=on.
If symbolic integration fails, you can define a simple integral
and/or derivative, (or adding integral into the inte.(x) library),
then do integration again (see Chapter 4.14 Learning from User).
4.6.1 Indefinite Integration
Find the indefinite integrals of expr by
inte(expr, x)
Find the double indefinite integrals by
inte(inte(expr, x), y)
Note that the arbitrary constant is not represented.
Example 4.6.1.
Find integrals of 1/a, 1/b and 1/x, knowing a >0, b is real.
IN: assume(a>0), isreal(b):=1
IN: inte(1/a, a), inte(1/b, b), inte(1/x, x)
OUT: ln(a), ln(|b|), ln(x*sign(x))
Example 4.6.2.
Find indefinite integrals.
IN: inte(sin(a*x+b), x) # integrands involving sin(x)
OUT: -cos(b + a x)/a
IN: inte( sin(x)/x^2, x)
OUT: ci(x) - sin(x)/x
IN: inte( x*sin(x), x)
OUT: -x cos(x) + sin(x)
IN: inte(sin(x)*cos(x), x)
OUT: (1/2)*sin(x)^2
IN: inte( e^(x^6), x) # integrands involving e^x
OUT: 1/6 ei(-5/6, x^6)
IN: inte( x^2*e^x, x)
OUT: ei(2, x)
IN: inte( x*e^(-x), x)
OUT: -e^(-x) - x e^(-x)
IN: inte( e^x/sqrt(x), x)
OUT: ei(-0.5, x)
IN: inte(x^1.5*exp(x), x)
OUT: ei(1.5, x)
IN: inte(sin(x)*e^x, x) # integrals involving sin(x) and e^x
OUT: 1/2 * (sin(x) - cos(x)) * e^x
IN: inte( x*ln(x), x) # integrands involving ln(x)
OUT: -1/4 x^2 + 1/2 x^2 ln(x)
IN: inte( ln(x)^6, x)
OUT: li(6, x)
IN: inte( ln(x)/(√x), x)
OUT: -4 √x + 2 √x ln(x)
IN: inte( ln(x)/sqrt(1 + x), x)
OUT: -4 √(1 + x) + 2 √(1 + x) ln(x) - 2 ln((-1 + √(1 + x))/(1 + √(1 + x)))
IN: inte( 1/(a x + b), x) # integrands involving polynomials
OUT: ln((b + a x) sign(b + a x))/a
IN: inte( x/(x^2 + 5 x + 6), x)
OUT: 1/2 ln(|6 + 5 x + x^2|) - 5/2 ln(|(2 + x)/(3 + x)|)
IN: inte( (x^3 + x)/(x^4 + 2 x^2 + 1), x)
OUT: 1/4 ln((1 + 2 x^2 + x^4) sign(1 + 2 x^2 + x^4))
Example 4.6.3.
Find the line integral.
IN: x:=2*t
IN: y:=3*t
IN: z:=5*t
IN: u:=x+y
IN: v:=x-y
IN: w:=x+y+z
IN: inte(u*d(u,t)+v*d(v,t)+w*d(w,t), t)
OUT: 63 t^2
Example 4.6.4.
Integrate x^2*e^x, then expand it by the mean of the
packages "ExpandEi.sm" (expand ei(n,x)). The packages "ExpandGa.sm"
(expand gamma(n,x)) and "ExpandLi.sm" (expand li(n,x)) are similar one.
IN: inte(x^2*e^x, x)
OUT: ei(2,x) # ei()
IN: readfile("ExpandEi.sm")
IN: ei(2, x)
OUT: x^2 e^x - 2 x e^x + 2 e^x # ei() is expanded
Defining integrals is similar to defining rules.
Example 4.6.5
IN: inte(f(x_), x_) := sin(x)
IN: inte(f(t), t)
OUT: sin(t)
4.6.2 Definite Integration
Find definite integrals by external functions
inte(expr, x from xmin to xmax)
inte(expr, x from xmin to singularity to xmax)
Example 4.6.6.
Find the definite integral of y=exp(1-x) with respect to x taken
from 0 to infinity.
IN: inte(exp(1-x), x from 0 to inf)
OUT: e
Example 4.6.7.
do discontinuous integration of 1/x^2 and 1/x^3 with discontinuty at x=0.
IN: inte(1/x^2, x from -1 to 2) # singularity at x=0
OUT: inf
IN: inte(1/x^3, x from -1 to 1) # singularity at x=0
OUT: 0
IN: inte(sqrt((x-1)^2), x from 0 to 2) # singularity at x=1
OUT: 1
SymbMath usually detect singularity, but sometime it cannot,
in this case you must provide singularity.
Example:
IN: inte(1/(x-1)^2, x from 0 to 1 to 2) # provide singularity at x=1
OUT: inf
Example 4.6.8
do complex integration.
IN: inte(1/x, x from i to 2*i)
OUT: ln(2)
4.6.3 Numeric Integration: NInte()
The external function
ninte(y, x from xmin to xmax)
does numeric integration.
Example 4.6.3.1.
Compare numeric and symbolic integrals of 4/(x^2+1) with
respect to x taken from 0 to 1.
IN: ninte(4/(x^2+1), x from 0 to 1)
OUT: 3.1415
IN: num(inte(4/(x^2+1), x from 0 to 1))
OUT: 3.1416